package com.health.pay.tencent.protocol.gettransferinfo;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

import com.health.pay.tencent.common.Signature;

public class GettransferinfoReq {
	
	private String mch_id;
	private String appid;
	private String partner_trade_no;
	private String nonce_str;
	private String sign;
	
	
	public GettransferinfoReq(String mchId, String appid,
			String partnerTradeNo, String nonceStr) {
		super();
		setMch_id(mchId);
		setAppid(appid);
		setPartner_trade_no(partnerTradeNo);
		setNonce_str(nonceStr);
		mch_id = mchId;
		String sign = Signature.getSign(toMap());

	}
	public String getMch_id() {
		return mch_id;
	}
	public void setMch_id(String mchId) {
		mch_id = mchId;
	}
	public String getAppid() {
		return appid;
	}
	public void setAppid(String appid) {
		this.appid = appid;
	}
	public String getPartner_trade_no() {
		return partner_trade_no;
	}
	public void setPartner_trade_no(String partnerTradeNo) {
		partner_trade_no = partnerTradeNo;
	}
	public String getNonce_str() {
		return nonce_str;
	}
	public void setNonce_str(String nonceStr) {
		nonce_str = nonceStr;
	}
	public String getSign() {
		return sign;
	}
	public void setSign(String sign) {
		this.sign = sign;
	}
	
    public Map<String,Object> toMap(){
        Map<String,Object> map = new HashMap<String, Object>();
        Field[] fields = this.getClass().getDeclaredFields();
        for (Field field : fields) {
            Object obj;
            try {
                obj = field.get(this);
                if(obj!=null){
                    map.put(field.getName(), obj);
                }
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return map;
    }
	
}
